package com.xcity.pomelo.response;

import java.util.List;

import com.xcity.game.common.ItemResponse;
import com.xcity.game.item.ItemTemplate;

import naga.x.App;
import naga.x.game.template.TemplateService;
import naga.x.net.impl.pomelo.PomeloMessage;
import naga.x.net.impl.pomelo.protocol.Message;

@PomeloMessage(type = Message.Type.RESPONSE)
public class PVEGetAllBoxResponse extends Response {

	private int page;
	private byte type;
	private List<Integer> stageIds;//变了哪个关卡(取名字  把宝箱清空)
	private int[] boxGotIndex;
	private byte starBoxCount;
	private int money;
	private int stone;
	private List<ItemResponse> items;
	public PVEGetAllBoxResponse(int serial, int page, byte type, List<Byte> gotBoxIndexList, List<Integer> stageIndex, byte starbox, int money, int stone, List<ItemResponse> items) {
		super(serial);
		this.page = page;
		this.type = type;
		this.stageIds = stageIndex;
		this.boxGotIndex = new int[gotBoxIndexList.size()];
		for(int i = 0; i < gotBoxIndexList.size(); i++){
			this.boxGotIndex[i] = gotBoxIndexList.get(i);
		}
		this.starBoxCount = starbox;
		this.money = money;
		this.stone = stone;
		TemplateService ts = App.getApp().getServiceManager().get(TemplateService.class);
		for(int i = 0; i < items.size(); i++){
			ItemResponse item = items.get(i);
			ItemTemplate itemTemp = ts.get(ItemTemplate.class, item.getId());
			if(itemTemp != null){
				item.setName(itemTemp.getName());
				item.setDesc(itemTemp.getDesc());
				item.setIcon(itemTemp.getIcon());
			}
		}
		this.items = items;
	}
	public int getPage() {
		return page;
	}
	public void setPage(int page) {
		this.page = page;
	}
	public byte getType() {
		return type;
	}
	public void setType(byte type) {
		this.type = type;
	}
	public List<Integer> getStageIds() {
		return stageIds;
	}
	public void setStageIds(List<Integer> stageIds) {
		this.stageIds = stageIds;
	}
	public byte getStarBoxCount() {
		return starBoxCount;
	}
	public void setStarBoxCount(byte starBoxCount) {
		this.starBoxCount = starBoxCount;
	}
	public int getMoney() {
		return money;
	}
	public void setMoney(int money) {
		this.money = money;
	}
	public int getStone() {
		return stone;
	}
	public void setStone(int stone) {
		this.stone = stone;
	}
	public List<ItemResponse> getItems() {
		return items;
	}
	public void setItems(List<ItemResponse> items) {
		this.items = items;
	}
	public int[] getBoxGotIndex() {
		return boxGotIndex;
	}
	public void setBoxGotIndex(int[] boxGotIndex) {
		this.boxGotIndex = boxGotIndex;
	}
}
